package com.invengo.module_check.data.api;


import com.invengo.library_db.entity.module_check.offline.BookJson;
import com.invengo.library_db.entity.module_check.ShelfJson;
import com.invengo.library_db.entity.module_check.StructBean;
import com.invengo.library_db.entity.module_check.offline.UserBean;

import java.util.List;

import io.reactivex.Observable;
import me.goldze.mvvmhabit.http.BaseBean;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface OfflineApi {
    /**
     * 获取所有用户
     *
     * @return {@link Observable}<{@link BaseBean}<{@link List}<{@link UserBean}>>>
     */
    @GET("api/Inventory/GetALLUser")
    Observable<BaseBean<List<UserBean>>> getAllUser();

    /**
     * 下载层位数据
     *
     */
    @GET("api/inventory/getstruct")
    Observable<BaseBean<List<StructBean>>> getStruct();

    /**
     * 获取所有图层
     *
     * @return {@link Observable}<{@link BaseBean}<{@link ShelfJson}>>
     */
    @GET("api/Inventory/GetAllLayer")
    Observable<BaseBean<ShelfJson>> getAllShelfJson();


    /**
     * 获取图书计数
     *
     * @param beginTime 开始时间
     * @param endTime   结束时间
     * @return {@link Observable}<{@link BaseBean}<{@link Long}>>
     */
    @POST("api/inventory/getbookcount")
    Observable<BaseBean<Long>> getBookCount(@Body RequestBody requestBody);

    /**
     * 获取图书计数
     *
     * @param beginTime 开始时间
     * @param endTime   结束时间
     * @return {@link Observable}<{@link BaseBean}<{@link Long}>>
     */
    @POST("api/inventory/getbookcount")
    Observable<BaseBean<Long>> getBookCount(@Query("beginTime") String beginTime,@Query("endTime") String endTime );


    /**
     * 获取书本分页数据  废弃，不要用，山东大学那边是这样搞的
     *
     * @param pageIndex 页面索引
     * @param pageSize  页面大小
     * @param beginTime 开始时间
     * @param endTime   结束时间
     * @return {@link Observable}<{@link BaseBean}<{@link ShelfJson}>>
     */
    @POST("api/inventory/getpagingdataofbook")
    Observable<BaseBean<BookJson>> getPagingDataOfBook(@Query("pageNum") String pageIndex, @Query("pageSize") String pageSize, @Query("beginTime") String beginTime, @Query("endTime") String endTime);

    /**
     *  获取书本分页数据
     *
     * @return {@link Observable}<{@link BaseBean}<{@link ShelfJson}>>
     */
    @POST("api/inventory/getpagingdataofbook")
    Observable<BaseBean<BookJson>> getPagingDataOfBook(@Body RequestBody requestBody);
}
